<script setup lang="ts">
const props = withDefaults(defineProps<{
  name?: string
  age?: number
  male?: string
}>(),{name:'fafayu',age:27,male:'man'})
console.log(props);
const emit = defineEmits<{
  (e:'changeAge',age:number):void
}>()
</script>

<template>
  <div>
    <h2>我是子组件</h2>
    <h3>{{name}}</h3>
    <h3>{{age}}</h3>
    <h3>{{male}}</h3>
    <button @click="emit('changeAge',props.age)">变成老登</button>
  </div>

</template>

<style scoped>
div {
  background-color: aqua;
}
</style>
